/**
 * All rights Reserved, Designed By OprCalf
 * Copyright:    Copyright(C) 2016-2020
 * Company       LengYin Ltd.
 */

package com.platform.gateway.agg;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.platform.gateway.common.annotation.RateLimit;
import com.platform.gateway.common.annotation.Security;
import com.platform.gateway.common.exception.CommonRuntimeException;
import com.platform.gateway.common.request.GetRequest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @projectName:  platform-gateway
 * @package:      com.platform.gateway.agg
 * @className:    AggController.java
 * @description:  聚合接口
 * @author:       OprCalf
 * @date:         2020年3月27日
 */
@Api(tags = { "聚合服务：聚合接口" })
@RestController
@RequestMapping("agg/test")
@SuppressWarnings("deprecation")
public class AggController {

    @Autowired
    private GetRequest getRequest;

    @ApiOperation(value = "聚合服务测试接口")
    @GetMapping(value = "getTest", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RateLimit(limitNum = 5)
    @Security
    public JSONObject getTest() throws CommonRuntimeException{
        // throw new CommonRuntimeException("测试聚合异常拦截");
        return getRequest.getNullUserForJson("http://ATOMIC-DATAS/", "/web/demo/user/test");
    }

}
